<?php
/**
 * Created by PhpStorm.
 * User: qingyun
 * Date: 19/5/5
 * Time: 上午10:16
 */

include_once './PHPMailer/src/PHPMailer.php';
include_once './PHPMailer/src/SMTP.php';
include_once './PHPMailer/src/Exception.php';


use PHPMailer\PHPMailer\PHPMailer;


$mail = new PHPMailer();


//Server settings
//$mail->SMTPDebug = 2;                                       // Enable verbose debug output

//邮件服务器的一些设置
$mail->isSMTP();                                            // Set mailer to use SMTP
$mail->Host       = 'smtp.qq.com';  // Specify main and backup SMTP servers
$mail->SMTPAuth   = true;                                   // Enable SMTP authentication
$mail->Username   = '1435681170@qq.com';                     // SMTP username
$mail->Password   = 'btczmhgcuabwbaaf';                               // SMTP password
$mail->SMTPSecure = 'ssl';                                  // Enable TLS encryption, `ssl` also accepted
$mail->Port       = 465;                                    // TCP port to connect to

//Recipients
//设置发送人的信息
$mail->setFrom('1435681170@qq.com', '陈天赐');
//$mail->addAddress('joe@example.net', 'Joe User');     // Add a recipient
//设置接收的邮件地址
$mail->addAddress('155166348@qq.com');               // Name is optional
//$mail->addReplyTo('info@example.com', 'Information');
//$mail->addCC('cc@example.com');
//$mail->addBCC('bcc@example.com');

// Attachments
//添加邮件的附件
$mail->addAttachment('./3333.jpg', '这是我们班的图.jpg');         // Add attachments
//$mail->addAttachment('/tmp/image.jpg', 'new.jpg');    // Optional name

// Content
//邮件内容的设置
$mail->isHTML(true);                                  // Set email format to HTML
$mail->Subject = '今天晚上请你吃饭';
$mail->Body    = '晚上去哪？<div style="color: red;">看我帅不帅</div>';
//$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';

var_dump($mail->send());
